# -*- coding: utf-8 -*-

import os
from datetime import date


def zipiname():
    """
    Builds a name for zipfile, based on date and username
    """
    user = str(os.getenv('USER'))
    now = date.today().strftime('%Y%m%d')
    return user + '-' + now + '.zip'


def e_endsw(f, extensions):
    """
    Checks if a file name endswith a group of extensions
    """
    for e in extensions:
        if f.endswith(e):
            return True


def e_wild(extensions):
    """
    Checks extensions wildcard *
    """
    return ('*' in extensions or '.*' in extensions)
